home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Initializing an Extension
- Sent: 3/12/96 9:55 AM
- Received: 3/12/96 8:57 AM
- From: Greg Friedman, friedman@cognosis.com
- Reply-To: ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- >The following questions and scenario might be [complex] so I hope
- >I state the problem clearly.
- >
- >I have created suite of SOM classes that implement a rich, hierarchical
- >data [model.] The scheme is this; a thing called a Property has
- >a name and a value. A value can be an integer, real, string, SOM call
- >[it looks pretty much like Property SOMClass:SOM Method( in Property
- >parameterList )], list of Properties, or an enumeration [of strings.]
- >
-
- Bernhard,
-
- Sorry for the delay in responding to your question, but I wanted to give it
- some thought. Jim and I spoke about it yesterday, and here's what we came
- up with.
-
- You want to extend the functional API of a part. The best way to do this is
- via an extension. Remember that an extension "extends the API" of the
- object that creates it. Attempting to circumvent extensions by extending
- the APIs of objects defined by OpenDoc by subclassing is going to cause you
- and anyone that tries to use your API headaches.
-
- If I understand your message correctly, it sounds like once you've begun a
- session with a part, you want to navigate the part's content model. You
- want the content model to appear to be a tree of objects, each node of
- which has properties that can be accessed by some other part. External
- parts might be interested in the state of a specific property, and need to
- be notified if it changes.
-
- At first glance, it looks like you are describing much of what the
- scripting implementation in OpenDoc provides. OpenDoc scripting is based on
- the Apple Event Object Model. Every object inside of a part is represented
- as an object that has properties and elements. Semantic events can be
- constructed that request property information and that access contained
- elements. My first suggestion is that you read Chapter 9 in the OpenDoc
- Programmer's Guide, "Semantic Events and Scripting", and determine whether
- or not you can accomplish your goal with scripting. You'll note, by the
- way, that scripting is implemented as an extension. One additional benefit
- of using scripting is that you will not only expose your data to parts that
- know how to talk your language, but you will also expose your data to a
- scripter who wants to script control of your part.
-
- Scripting solves the data exposure problem, but it doesn't provide a
- built-in mechanism for notification. If, for this reason or others, you
- decide that you don't want to use scripting, you can accomplish your design
- with SOM objects as your message suggests. I strongly suggest that your
- design provide access to the root object of a part via an extension. Your
- extension API might be as simple as a single method called
- "GetRootInspectableObject".
-
- The root object can then provide access to its contained objects. As I
- mentioned above, anything you do here will look a lot like a scripting
- implementation. To give you a sense of what I mean by this, I'll give you a
- peek at what the scripting implementation in ODF 1 looks like.
-
- In ODF 1, any object can be made scriptable. This is accomplished by mixing
- a new class, FW_MScriptable, into an object. Once an object is scriptable,
- it has the following functionality:
-
- Semantic access to contained elements. Elements can be accessed by a large
- set of semantic forms (by index, name, relative position, unique id,
- satisyfing a test, etc.) ODF provides much of the default access
- functionality.
-
- Accessible and mutable properties. Built-in support for undo of property
- mutation. You write code to handle getting and setting a property. When a
- semantic "Set Property" event occurs, ODF invisibly gets the old property
- state, and creates an undoable command that can undo/redo the property
- change.
-
- Creation of object specifiers. Any scriptable object can create a data
- structure understood by the OpenScriptingArchitecture that describes its
- location in the object hierarchy.
-
- Handling of semantic events.
-
- Etc, etc.
-
- You may decide to do something like this, but have each object factory a
- SOM object that provides access to its properties. You still have to deal,
- on your own, with the fact that after an SOM object has been created, the
- base object that created it might go away. You also have to deal with
- notification. The best approach will be to use SOM. This will require the
- interested object to be a SOM object of a specific class.
-
- Hope this helps,
-
- Greg.
-
-
- ___________________________________________________________
- Greg Friedman ODF Engineering Apple Computer
-
-